package Person.jihe;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo03 {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<String,String>();
        map.put("张无忌","户总");
        map.put("郭靖","黄总");
        map.put("杨过","龙总");
        //V.get(Object key): 根据键获取值
        System.out.println(map.get("张无忌"));
        System.out.println(map.get("张三丰"));
        //Set<K> keySet ():获取所有键的集合
        System.out.println("----------");
        Set<String> keySet = map.keySet();
        for(String key:keySet){
            System.out.println(key);
        }
        System.out.println("-------------");
        //Collection<V> values():获取所有值的集合
        Collection<String> values = map.values();
        for(String value:values){
            System.out.println(value);
        }
    }
}
